﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Database_connect
{
    abstract class DatabaseConnection
    {
        private string connectionString;
        public  string ConnectionString
        {
            get
            {
                return connectionString;
            }

            set
            {
                if (String.IsNullOrWhiteSpace(value))
                throw new ArgumentNullException("Connection string can not be empty");
            }
        }

        public DatabaseConnection (string connectionStr, TimeSpan timeout)
        {
            ConnectionString = connectionStr;
            ConnectionTimeout = timeout;
        }
        
        public TimeSpan ConnectionTimeout { get; set; }

        public abstract void OpenConnection();

        public abstract void CloseConnection();
        
    }
}
